import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'

import Header from '@/components/Header'
import Footer from '@/components/Footer'
import TypeNav from '@/pages/Home/TypeNav'
import Carousel from '@/components/Carousel'
import Pagination from '@/components/Pagination'

//测试获取数据
// import { reqCategory } from '@/api';
// console.log('入口文件地方',reqCategory());
// store.dispatch('home/getBannerList')
// 测试结束

import { MessageBox } from 'element-ui';
//按需引入写法不同的:MessageBox、Message、Loading、Notification
Vue.prototype.$msgbox = MessageBox;
//消息提示框
Vue.prototype.$alert = MessageBox.alert;

Vue.component(Header.name, Header)
Vue.component(Footer.name, Footer)
Vue.component(TypeNav.name, TypeNav)
Vue.component(Carousel.name, Carousel)
Vue.component(Pagination.name, Pagination)

// 引入mockServe.js----mock数据
import '@/mock/mockServe'

Vue.config.productionTip = false

//将项目全部请求函数引入进来[分别暴露]
import * as API from '@/api'


// 引入图片懒加载
import VueLazyload from 'vue-lazyload'
// 引入懒加载显示的图片atm
import atm from '@/assets/1.gif';
Vue.use(VueLazyload, {
  loading: atm,
})

// 引入表单验证插件
import "@/plugins/validate"

new Vue({
  // 配置全局事件总线
  beforeCreate() {
    //配置全局事件总线
    Vue.prototype.$bus = this
    // 通过Vue.prototype原型对象，
    // 将全部请求函数挂载到原型对象身上[VC：就可以使用请求函数]
    Vue.prototype.$API = API
  },
  router,
  store,
  render: (h) => h(App)
}).$mount('#app')
